import pdfplumber

# 打开pdf文件
with pdfplumber.open('测试.pdf') as pdf:
    for i in pdf.pages:
        # print(i, type(i))
        print(i.extract_text())
        print('----------------------')